package com.example.spring.restful.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
 * @author : zhayh
 * @date : 2021-2-27 21:12
 * @description :
 */

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonPropertyOrder(value = {"content", "title"})
@ApiModel(value = "Article", description = "文章对象")
public class Article {
    @ApiModelProperty(notes = "文章id", name="id", required = true, dataType = "Long")
    private Long id;

    @JsonProperty("author")
    @ApiModelProperty(notes = "文章作者", name="author", required = true)
    private String author;

    @ApiModelProperty(notes = "文章标题", name="title", required = true)
    private String title;

    @ApiModelProperty(notes = "文章内容", name="content", required = false)
    private String content;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(notes = "文章创建时间", name="createTime", required = false, dataType = "date")
    private Date createTime;
    @ApiModelProperty(notes = "读者列表", name="readers", required = false, dataType = "list")
    private List<Reader> readers;
}
